#!/usr/bin/env python
import os
import pygame
from pygame.locals import *

pygame.init()

class Circle(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)

        #http://www.pygame.org/docs/ref/image.html#pygame.image.load
        #load the circle.png image file so we can add it to the display
        filename = os.path.join("images", "circle.png")
        image = pygame.image.load(filename)

        #http://www.pygame.org/docs/ref/surface.html#pygame.Surface.convert_alpha
        #self.image is a pygame.Surface object
        self.image = image.convert_alpha()

     
screenh = 400
screenw = 400

#http://www.pygame.org/docs/ref/display.html#pygame.display.set_mode
#screen is a pygame.Surface object
#this is the game window
screen = pygame.display.set_mode((screenh, screenw))

#http://www.pygame.org/docs/ref/display.html#pygame.display.set_caption
pygame.display.set_caption("Example 1")

#http://www.pygame.org/docs/ref/surface.html
#background is a pygame.Surface object
background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill((100,200,255))

#http://www.pygame.org/docs/ref/surface.html#pygame.Surface.blit
#draw the background onto the screen
screen.blit(background, (0,0))

#http://www.pygame.org/docs/ref/display.html#pygame.display.flip
#update the game window
pygame.display.flip()

circle = Circle()

#http://www.pygame.org/docs/ref/time.html#pygame.time.Clock
#the clock used to time frame rate
clock = pygame.time.Clock()

#60 frames per second
framerate = 60

#variables used to set the position of the circle
x=0
y=0


while True:
    clock.tick(60)
    for event in pygame.event.get():
        if event.type == QUIT:
            exit(0)
    screen.blit(background, (0,0))
    x+=1
    y+=1
    screen.blit(circle.image, (x, y))
    pygame.display.flip()
